package com.asialjim.wechat.apiservice.executor;

import com.asialjim.wechat.apiservice.Api;
import com.asialjim.wechat.apiservice.ApiRequest;
import java.io.IOException;
import java.util.Map;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: ApiExecutor ]</i></h2><strong>
 * <p> api executor
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/1   &nbsp;&nbsp; JDK 8
 */
public interface ApiExecutor{
//    String WE_CHAT_DOWNLOAD_API_TEMP_FILEPATH = "/home/we_chat/api/download/";

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: execute ]</i></h3>
     * execute api
     * @param api {@link Api <T> api}
     * @param urlParam {@link ApiRequest.RequestUrlParam url param}
     * @param bodyParam {@link ApiRequest.RequestBodyParam body param}
     * @return {@link T api response}
     * @throws IOException io exception
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/1 16:20
     */
    <T> T execute(Api api, ApiRequest.RequestUrlParam urlParam, ApiRequest.RequestBodyParam bodyParam) throws IOException;

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: execute ]</i></h3>
     * execute api
     * @param domain {@link String api domain}
     * @param api {@link Api <T> api}
     * @param urlParam {@link ApiRequest.RequestUrlParam url param}
     * @param bodyParam {@link ApiRequest.RequestBodyParam body param}
     * @return {@link T api response}
     * @throws IOException io exception
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/1 16:20
     */
    <T> T execute(String domain, Api api, ApiRequest.RequestUrlParam urlParam, ApiRequest.RequestBodyParam bodyParam) throws IOException;

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: execute ]</i></h3>
     * execute api
     * @param api {@link Api <T> api}
     * @param urlParam {@link ApiRequest.RequestUrlParam url param}
     * @param bodyParam {@link ApiRequest.RequestBodyParam body param}
     * @param responseClass {@link Class<T> responseClass}
     * @return {@link T api response}
     * @throws IOException io exception
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/2 11:15
     */
    <T> T execute(Api api, ApiRequest.RequestUrlParam urlParam, ApiRequest.RequestBodyParam bodyParam, Class<T> responseClass) throws IOException;

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: execute ]</i></h3>
     * execute api
     * @param api {@link Api <T> api}
     * @param urlParam {@link Map url param}
     * @param bodyParam {@link ApiRequest.RequestBodyParam body param}
     * @param responseClass {@link Class<T> responseClass}
     * @return {@link T result}
     * @throws IOException io exception
     * @author Asial Jim &nbsp;&nbsp; <span>Email: &nbsp;&nbsp; <a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
     * @since 2021/3/2 14:54
     */
    <T> T execute(Api api, Map<String,Object> urlParam, ApiRequest.RequestBodyParam bodyParam, Class<T> responseClass) throws IOException;

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: execute ]</i></h3>
     * execute api
     * @param api {@link Api <T> api}
     * @param urlParam {@link Map url param}
     * @param bodyParam {@link ApiRequest.RequestBodyParam body param}
     * @return {@link T response}
     * @throws IOException io exception
     * @author Asial Jim &nbsp;&nbsp; <span>Email: &nbsp;&nbsp; <a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
     * @since 2021/3/2 14:55
     */
    <T> T execute(Api api, Map<String,Object> urlParam, ApiRequest.RequestBodyParam bodyParam) throws IOException;


}